import * as Types from './actionTypes'
const defaultState = {
    inputValue: '',
    list: []
}
export default (state = defaultState, action) => {
    const newState = JSON.parse(JSON.stringify(state))
    switch (action.type) {
        case Types.CHANGE_INPUT_VALUE:
            newState.inputValue = action.value
            break;
        case Types.ADD_LIST:
            newState.list.push(newState.inputValue)
            newState.inputValue = ''
            break;
        case Types.DEL_LIST:
            newState.list.splice(action.index, 1)
            break;
        default:
            return newState
    }
    return newState
}